import { BaseRuntime } from "./BaseRuntime";
import GlobalData  from "../core/global";

export default class SettingPanel extends BaseRuntime{
    constructor(){
        super();
    }

    onAwake(){
        super.onAwake();
        let wh = this.getBounds();
        let _sounds = GlobalData.instance.manager_prefab.instancePrefab('switch_button');
        _sounds.setData("sounds","音效","已打开","已关闭");
        _sounds.x = wh.width/2 + 50;
        _sounds.y = wh.height/2 - 40;
        this.addChild(_sounds);

        let music = GlobalData.instance.manager_prefab.instancePrefab('switch_button');
        music.setData("music","音乐","已打开","已关闭");
        music.x = wh.width/2 + 50;
        music.y = wh.height/2 + 20;
        this.addChild(music);
    }

    shareClick(){
        GlobalData.instance.adapter.share();
    }

    musicClick(){
        Laya.SoundManager.musicMuted = !Laya.SoundManager.musicMuted;
    }

    soundsClick(){
        Laya.SoundManager.soundMuted = !Laya.SoundManager.soundMuted;
    }

}